package com.baidu.interview;

import java.util.Scanner;

/**
 * @author ZhangyiA
 * @describe: 选角色
 * C++ 中可以直接调用 lower_bound 函数 , 本质是 二分的思想
 * @date 2021/07/03
 */

public class Two_ChooseActor {

    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int T = input.nextInt();
        while(T -- > 0){
            int n = input.nextInt();
            int m = input.nextInt();
            int[] actors = new int[n];
            int[] movies = new int[m];
            for(int i = 0 ; i < n ; i ++){
                actors[i] = input.nextInt();
            }
            for(int i = 0 ; i < m ; i ++){
                movies[i] = input.nextInt();
            }
            // 二分查找位置
            for(int i = 0 ; i < actors.length ; i ++){
                int left = 0 , right = movies.length;
                while(left < right){
                    int mid = left + (right - left) / 2;
                    if(movies[mid] >= actors[i]) right = mid;
                    else left = mid + 1;
                }
                if(i == 0){
                    System.out.print(m - left);
                } else {
                    System.out.print(" " + (m - left));
                }
            }
        }
    }
}
/*
1
3 6
33 66 99
3 6 9 30 60 90
* */